//package com.kobeliu.api.config;
//
//import com.kobeliu.exceptions.GraceException;
//import com.kobeliu.result.ResponseStatusEnum;
//import org.apache.commons.lang3.StringUtils;
////import org.apache.zookeeper.KeeperException;
////import org.apache.zookeeper.ZooKeeper;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.PostConstruct;
//import javax.annotation.PreDestroy;
//import java.io.IOException;
//
//@Component
//public class ZkConnecter {
//
//    public static ZooKeeper zooKeeper = null;
//
//    @PostConstruct
//    public void init() throws IOException {
//
//        zooKeeper = new ZooKeeper(
//                "82.157.139.206:2181",
//                5*1000,
//                null);
//    }
//
//
//    @PreDestroy
//    public void close() throws InterruptedException {
//        if(zooKeeper != null){
//            zooKeeper.close();
//        }
//    }
//
//    /**
//     * 获得锁
//     * @param lockName
//     */
//    public ZkLock getLock(String lockName) throws InterruptedException, KeeperException {
//
//        if(StringUtils.isBlank(lockName)){
//            GraceException.display(ResponseStatusEnum.SYSTEM_ERROR_ZUUL);
//        }
//        return new ZkLock(zooKeeper,lockName);
//    }
//}
